package com.hyperboost.deepseek.controller;

import com.hyperboost.deepseek.assistant.DeepSeek;
import com.hyperboost.deepseek.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@Tag(name = "DeepSeek")
@RestController
@RequestMapping("/frontend/deepseek")
public class DeepSeekController {

    @Autowired
    private DeepSeek deepSeek;


    /**
     * DeepSeek chat
     * @param chatForm
     * @return
     */
    @Operation(summary = "DeepSeek chat")
    @PostMapping(value = "/chat",produces = "text/stream;charset=UTF-8")
    public Flux<String> chat(@RequestBody ChatForm chatForm){
        return deepSeek.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }
}
